# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pyrtlsdr
pkgname=('python2-pyrtlsdr' 'python-pyrtlsdr')
_pkgname=pyrtlsdr
pkgver=0.3.0
pkgrel=3
epoch=1
pkgdesc="A Python wrapper for librtlsdr (a driver for Realtek RTL2832U based SDR's)."
arch=('any')
url='https://pypi.org/project/pyrtlsdr/#files'
license=('APACHE')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('9a1613b1d3fc4caf654ffa466b14a07d9826ce6750b58447af535c8c7fdc9dcf8b6e5e329088aad21cbf4975c32c9ef62a3329aed3694135a94165023bbed028')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pyrtlsdr() {
  depends=('python2' 'python2-m2r')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-pyrtlsdr() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

